/**
 * UserDaoImpl.java
 * jp.co.greenblue.ecodasweb.dao.impl
 *
 * Function�F TODO 
 *
 *   ver     date      		author
 * ��������������������������������������������������������������������
 *   		 2010/11/04 		jonsion
 *
 * Copyright (c) 2010, GreenBlue .  All Rights Reserved.
*/

package jp.co.greenblue.ecodasweb.dao.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Order;
import org.springframework.orm.hibernate3.HibernateCallback;

import jp.co.greenblue.ecodasweb.dao.BaseDao;
import jp.co.greenblue.ecodasweb.dao.IUserDao;
import jp.co.greenblue.ecodasweb.domain.User;

/**
 * ClassName:UserDaoImpl
 * Function: TODO ADD FUNCTION
 * Reason:	 TODO ADD REASON
 *
 * @author   jonsion
 * @version  
 * @since    Ver 1.1
 * @Date	 2010/11/04		16:45:56
 *
 * @see 	 
 */
public class UserDaoImpl extends BaseDao implements IUserDao {

	@Override
	public User getUserByUserName(String userName,String passWord) {
		List<User> list= (List<User>)this.getHibernateTemplate().findByNamedParam("FROM User AS u WHERE u.userName=:username AND u.passWord=:password",new String[]{"username","password"},new String[]{userName,passWord});
		if(list.size()==0)
			return null;
		else
			return list.get(0);
		
	}

//	public List<Object> search(final Object object) {
//		return super.getHibernateTemplate().executeFind(
//		new HibernateCallback(){
//		public Object doInHibernate(Session s)throws HibernateException{
//		Criteria c=s.createCriteria(Object.class);
//		if(null!=object){
//		return null;
//		}
//		c.addOrder(Order.asc(""));
//		return c.list();
//		}
//		});
//		}
}

